<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>" />
<title>ComPro Admission</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link href="<c:url value="/resources/style.css"/>" rel="stylesheet"
	type="text/css" />
<script type="text/javascript" src="resources/js/jquery.js"></script>
<script type="text/javascript" src="resources/js/jquery.validate.min.js"></script>
<script type="text/javascript" src="resources/js/cufon-yui.js"></script>
<script type="text/javascript" src="resources/js/arial.js"></script>
<script type="text/javascript" src="resources/js/cuf_run.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$('#passwordForm').validate({
			rules : {
				old_pwd : {
					required : true,
					minlength : 8,
					remote : {
						url : "changePassword/validatePassword",
						type : "GET",
						data : {
							old_pwd : function() {
								return $('#old_pwd').val();
							}
						}
					}
				},
				new_pwd : {
					required : true,
					minlength : 8,
				},
				confirm_pwd : {
					required : true,
					minlength : 8,
					equalTo : "#new_pwd"
				}
			},
			messages : {
				old_pwd : {
					remote : "Password is incorrect."
				}
			}
		});

		$('#change_pwd').click(function() {
			$('#passwordForm').attr('action', 'changePassword');
			$('#passwordForm').attr('method', 'post');
			$('#passwordForm').submit();
		});

	});
</script>
</head>
<body>

	<%@include file="header.jsp"%>
	<div class="main">
		<div class="body">
			<div class="body_resize">
				<div class="left">
					<br />
					<h2>Change Password</h2>
					<form name="passwordForm" id="passwordForm">
						<table>
							<tr>
								<td><label for="old_pwd">Old Password</label></td>
								<td>:</td>
								<td><input id="old_pwd" name="old_pwd" class="text"
									type="password" /></td>
							</tr>
							<tr>
								<td><label for="new_pwd">New Password</label></td>
								<td>:</td>
								<td><input id="new_pwd" name="new_pwd" class="text"
									type="password" /></td>
							</tr>

							<tr>
								<td><label for="confirm_pwd">Confirm Password</label></td>
								<td>:</td>
								<td><input id="confirm_pwd" name="confirm_pwd" class="text"
									type="password" /></td>
							</tr>
						</table>
						<input type="button" value="Change Password" id="change_pwd" />
					</form>
					<h3>&nbsp;</h3>
				</div>

		
				<c:choose>
					<c:when test="${user.role == 'applicant'}">
						<%@include file="sideuser.jsp"%>
					</c:when>
					<c:when test="${user.role == 'admission'}">
						<%@include file="sideAdmission.jsp"%>
					</c:when>
					<c:otherwise>
						<%@include file="sidemenu.jsp"%>
					</c:otherwise>
				</c:choose>


			</div>
			<br />
		</div>


		<%@include file="footer.jsp"%>
	</div>
	<div align=center></div>
</body>
</html>
